<html>
    <head>
        <title></title>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


    <script type="text/javascript">
    function PovolenyZnak(event){
    if (event.keyCode == 3 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 13 || (event.keyCode > 46 && event.keyCode < 59))
    event.returnValue= true;
    else {
    event.returnValue= false;
    alert("Nezlob!\nČísla nebo /.");}
    }
    </script>
    </head>
    <body  bgcolor="#e0e0e0">
<table>
<tr><td><img src="img/vogon1.jpg" align="middle" alt=""></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><font size="+4"><b>Vogoni</b></font><br><font size="-1">Bez papíru nejsi nic.</font></td></tr>
</table>
<?php
require_once 'inc/mysql.inc.php';
//$id=6;
$id=$_GET['id'];
?>
<table>
<tr><td valign="top">
<table>
<tr><td><b>Pracovníci</b>:</td></tr>
<tr><td><form action="Edit.php" method="get"><input type="hidden" name="id" value="0" /><input type="submit" value="Vytvořit nového"/></form></td></tr>
<?php
$result = mysql_query("SELECT * FROM People WHERE `:active`=1 ORDER BY `People`.`:last` ASC;");
while ($row = mysql_fetch_array($result)) {
  echo "<tr><td><A HREF=\"?id=".$row['id']."\">".$row[':first']." ".$row[':last']."</A></td><td> <A HREF=\"Preradit.php?id=".$row['id']."\"><font size=\"-1\"><b>vyloučit</b></font></A></td></tr>";
}
mysql_free_result($result);
echo "<tr><td><b>Mimo službu</b>:</td></tr>";
$result = mysql_query("SELECT * FROM People WHERE `:active`=0 ORDER BY `People`.`:last` ASC;");
while ($row = mysql_fetch_array($result)) {
  echo "<tr><td>".$row[':first']." ".$row[':last']."</td><td> <A HREF=\"Preradit.php?id=".$row['id']."\"><font size=\"-1\"><b>povolat</b></font></A></td></tr>";
}
mysql_free_result($result);
?>

</table>
</td>
<td width="20px"></td>
<td valign="top">
<?php $result = mysql_query("SELECT * FROM People WHERE `id`=$id;");
$worker = mysql_fetch_array($result);?>
<form action="Insert.php" method="post">
<input type="hidden" name="id" value="<?php echo $id;?>" />
<table>
<tr><td></td><td><?php echo $worker['Name'];?></td></tr>
<tr><td>Tituly před:</td><td><input type="text" name="degree-before" value="<?php echo $worker[':degree-before'];?>" /></td></tr>
<tr><td>Jméno:</td><td><input type="text" name="firstname" value="<?php echo $worker[':first'];?>"/></td></tr>
<tr><td>Prostřední:</td><td><input type="text" name="midlename" value="<?php echo $worker[':midle'];?>"/></td></tr>
<tr><td>Příjmení:</td><td><input type="text" name="lastname" value="<?php echo $worker[':last'];?>"/></td></tr>
<tr><td>Tituly za:</td><td><input type="text" name="degree-after" value="<?php echo $worker[':degree-after'];?>"/></td></tr>
<tr><td>Jméno v rozvrhu:</td><td><input type="text" name="schedule-alias" value="<?php echo $worker[':schedule-alias'];?>"/></td></tr>
<tr><td>Adresa:</td><td><input type="text" name="address" value="<?php echo $worker['Adress'];?>"/></td></tr>
<tr><td>Úvazek:</td><td><input type="text" name="work-load" value="<?php echo $worker[':work-load'];?>" onkeypress="PovolenyZnak(event);"/> ⬅ Zlomek nebo celé číslo (např. 3/10).</td></tr>
<tr><td>Formuláře:</td><td><input type="checkbox" name="forms-single" value="1" <?php if(($worker[':forms'] & 1) != 0) echo"checked=\"checked\"";?>/>Single 
                           <input type="checkbox" name="forms-kumula" value="2" <?php if(($worker[':forms'] & 2) != 0) echo"checked=\"checked\"";?>/>Kumula</td></tr>
<tr><td>Nepracuje:</td><td><input type="checkbox" name="Po" value="1" <?php if(($worker[':exclude'] & 1) != 0) echo"checked=\"checked\"";?>/>Po 
                           <input type="checkbox" name="Ut" value="2" <?php if(($worker[':exclude'] & 2) != 0) echo"checked=\"checked\"";?>/>Út
                           <input type="checkbox" name="St" value="4" <?php if(($worker[':exclude'] & 4) != 0) echo"checked=\"checked\"";?>/>St
                           <input type="checkbox" name="Ct" value="8" <?php if(($worker[':exclude'] & 8) != 0) echo"checked=\"checked\"";?>/>Čt
                           <input type="checkbox" name="Pa" value="16" <?php if(($worker[':exclude'] & 16) != 0) echo"checked=\"checked\"";?>/>Pá
                            ⬅ s tímto opatrně!</td></tr>
<tr><td>Typ:</td><td><input type="radio" name="type" value="Akademik" <?php if($worker[':type'] == ":academic") echo"checked=\"checked\"";?> /> Akademik
                     <input type="radio" name="type" value="Technik" <?php if($worker[':type'] == ":tech") echo"checked=\"checked\"";?>/> Technik</td></tr>
<tr><td>Granty:</td><td>
<table>
<tr><td>Grant</td><td>Úvazek</td></tr>
<?php
$result = mysql_query("SELECT * FROM projects;");
while ($row = mysql_fetch_array($result)) {
  $ProjId = $row['id'];
  $resProj = mysql_query("SELECT * FROM PeopleInProjects WHERE `person`=$id AND `project`=$ProjId;");
  $curProj = mysql_fetch_array($resProj);
  if($curProj) $load = $curProj[':work-load']; else $load = 0;
  echo "<tr><td>".$row['Name']."</td><td><input type=\"text\" name=\"".$ProjId."\" value=\"$load\" onkeypress=\"PovolenyZnak(event);\"/> ⬅ Zlomek nebo celé číslo.</td></tr>";
}
mysql_free_result($result);
?>
<tr><td></td><td>Pro vyřazení z grantu, zadejte úvazek 0.</td></tr>
</table></td></tr>
</table>
<input type="submit" value="Uložit/Vložit"/>
</form>
<form action="Preradit.php" method="get"><input type="hidden" name="id" value="<?php echo $id;?>" /><input type="submit" value="Do důchodu"/>
</form>
</td>
</tr>
</table>



</body>
</html>